<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo ($title); ?></title>
    <meta name="keywords" content="<?php echo ($title); ?>">
    <meta name="description" content="<?php echo ($title); ?>">
    <link href="/Public/static/admin/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/Public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/static/admin/css/style.min.css" rel="stylesheet">
    <style type="text/css">
        img{
            width: 50px;
            height: 50px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>商品表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-2">
                            <div class="input-group">
                                <a href="<?php echo U('add');?>" class="btn btn-outline btn-primary ">添加商品</a>
                            </div>
                        </div>
                        <form name="goods_list" id="goods_list" action="<?php echo U();?>" method="get">
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入关键词" class="input-sm form-control" name="word" id="word" value="<?php echo ($word); ?>">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary">搜 索</button>
                                    </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>商品名</th>
                                <th>品牌</th>
                                <th>类别</th>
                                <th>缩略图</th>
                                <th>市场价</th>
                                <th>本店价</th>
                                <th>库存</th>
                                <th>积分商品</th>
                                <th>所需积分</th>
                                <th>上架状态</th>
                                <th>精品</th>
                                <th>惊品</th>
                                <th>返积分比例</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="list_content">
                            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($v["id"]); ?></td>
                                    <td><?php echo ($v["goods_name"]); ?></td>
                                    <td><?php echo ($v["brand_name"]); ?></td>
                                    <td><?php echo ($v["classification"]); ?></td>
                                    <td>
                                        <?php if(empty($v["litimg"])): ?><img alt="image" class="img-thumbnail" src="/Upload/image/goods_img/20170227/58b37c601af48.jpg">
                                            <?php else: ?>
                                            <img alt="image" class="img-thumbnail" src="<?php echo ($v["litimg"]); ?>"><?php endif; ?>
                                    </td>
                                    <td><?php echo ($v["market_price"]); ?></td>
                                    <td><?php echo ($v["fd_price"]); ?></td>
                                    <td><?php echo ($v["number"]); ?></td>
                                    <td><a class="btn btn-<?php echo ($v['is_integral']?'primary':'danger'); ?> btn-xs" href="javascript:;"><?php echo ($v['is_integral']?'是':'否'); ?></a></td>
                                    <td><?php echo ($v["integral"]); ?></td>
                                    <td><a id="sale<?php echo ($v["id"]); ?>" class="btn btn-<?php echo ($v['is_sale']?'primary':'danger'); ?> btn-xs" href="javascript:;" onclick="changeSale(<?php echo ($v["id"]); ?>)"><?php echo ($v['is_sale']?'已 上 架':'下 架'); ?></a></td>
                                    <td><a id="boutique<?php echo ($v["id"]); ?>" class="btn btn-<?php echo ($v['is_boutique']?'primary':'danger'); ?> btn-xs" href="javascript:;" onclick="changeBoutique(<?php echo ($v["id"]); ?>)"><?php echo ($v['is_boutique']?'是':'否'); ?></a></td>
                                    <td><a id="surprise<?php echo ($v["id"]); ?>" class="btn btn-<?php echo ($v['is_surprise']?'primary':'danger'); ?> btn-xs" href="javascript:;" onclick="changeSurprise(<?php echo ($v["id"]); ?>)"><?php echo ($v['is_surprise']?'是':'否'); ?></a></td>
                                    <td><?php echo $v['ret_integral'].'%'?></td>
                                    <td><?php echo (date("Y-m-d H:i",$v["add_time"])); ?></td>
                                    <td>
                                        <a href="javascript:;" class="btn btn-primary btn-xs" onclick="edit(<?php echo ($v["id"]); ?>)"><i class="fa fa-edit"></i> 编 辑</a> &nbsp;&nbsp;
                                        <a href="javascript:;" class="btn btn-danger btn-xs" onclick="del(<?php echo ($v["id"]); ?>)"><i class="fa fa-trash-o"></i> 删 除</a>
                                    </td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                        <?php echo ($page); ?>
                    </div>
                    <div class="spiner-example">
                        <div class="sk-spinner sk-spinner-three-bounce">
                            <div class="sk-bounce1"></div>
                            <div class="sk-bounce2"></div>
                            <div class="sk-bounce3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/Public/static/admin/js/jquery.min.js"></script>
<script src="/Public/static/admin/js/bootstrap.min.js"></script>
<script src="/Public/static/admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/static/admin/js/plugins/laypage/laypage.js"></script>
<script src="/Public/static/admin/js/plugins/laytpl/laytpl.js"></script>
<script src="/Public/static/admin/js/common.js"></script>
<script>
    //修改
    function edit(id){
        location.href = '/admin/goods/edit/id/'+id+'.html';
    }

    //删除
    function del(id){
        sxshop.del(id,"<?php echo U('del');?>","<?php echo U();?>")
    }
    //修改上架状态
    function changeSale(id){
        var objectSale = $('#sale'+id);
        sxshop.sale(id,"<?php echo U('changeSale');?>",objectSale);
    }

    //修改加精状态
    function changeBoutique(id){
        var objectBoutique = $('#boutique'+id);
        sxshop.boutique(id,"<?php echo U('changeBoutique');?>",objectBoutique);
    }

    //修改加惊状态
    function changeSurprise(id){
        var objectSurprise = $('#surprise'+id);
        sxshop.surprise(id,"<?php echo U('changeSurprise');?>",objectSurprise);
    }
</script>
</body>
</html>